﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web_Blog
{
    public partial class CacBaiViet : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //Kiểm tra đăng nhập chưa
            if (Session["uID"] == null)
            {
                Session["url"] = Request.RawUrl;
                Response.Redirect("DangNhap.aspx");
            }

            if (Request.QueryString["u"] == null)
                dsbaiviet.InnerHtml = Controler.POST.LoadPostList(int.Parse(Session["uID"].ToString()), -1);         //uID flag -1 la blog chinh chu
            else
            {
                int uidrequest = int.Parse(Request.QueryString["u"].ToString());
                dsbaiviet.InnerHtml = Controler.POST.LoadPostList(uidrequest,uidrequest);  //uID flag -1 la blog ko chinh chu
            }


            Object.UserProfileObject up = new Object.UserProfileObject();
            if (Request.QueryString["u"] == null)
                up = Controler.Account.LoadProfile(int.Parse(Session["uID"].ToString()));
            else
                up = Controler.Account.LoadProfile(int.Parse(Request.QueryString["u"].ToString()));
        }

        }
    }
